Accessibility

Inserting a Text Link

In this section, you will add a text link to the page you created. Follow the steps below:

  1. Place your cursor within the table you created under the calendar in the previous section and type either "Close Window" or "Back" (without the quotation marks).
  2. Highlight the text, and click both the bold and italics buttons to format the text.

    Your page should now look like the illustration below.

    Figure 1.1: Close window in new table

    Figure 1.1: Close window in new table

  3. Select either the text "Close Window" or "Back", click the Insert Link symbol in the toolbar, and choose Drafts and Recent Pages… as shown in the illustration below.

    Figure 4: Insert link

    Figure 4: Insert link

  4. Click the Advanced button at the bottom of the Insert Link window (see Figure 5). The lower part of this window will open, and the dialog should appear as shown in Figure 6 below.

    Figure 5: Insert Link window

    Figure 5: Insert Link window

  5. Type one of the following lines of JavaScript code in the HREF: field. The line of JavaScript you enter depends on whether you have chosen to create a "Close Window" link or a "Back" link. (Don't forget the semicolon at the end of the line!)

    For the "Close Window" link, enter:
    javascript:window.close();

    For the "Back" link, enter:
    javascript:history.back();

    As shown in the illustration below, the dialog should appear with the JavaScript in the HREF field.

    Figure 6: Adding the JavaScript command

    Figure 6: Adding the JavaScript command

  6. Click OK to close the Insert Link dialog.
  7. Preview the page by pressing the F12 key and test your Close Window link. If it does not work, go back to the Insert Link window (Figure 6) and check the spelling and punctuation of your JavaScript command.
  8. Publish your page by clicking the Publish button in the upper left corner of Contribute. You will be prompted to choose a file name. Name the file April2003.htm and click the Publish button to close the Publish New Page dialog.

    Caution:
    •Never add a "Close Window" link to a page if that page will not be opened in a new window. Doing so would force the visitor to relaunch his or her browser and renavigate to your website.
    •A "Back" link only works if the page was not opened in a new window.

Nice work! You have successfully used JavaScript with Contribute to create a text-based link that either closes a browser window or returns the visitor to the previous page. In the next sections, you will create image-based and Macromedia Flash button-based links that do the same thing.